import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.HashMap;


public class StateSimple {
	
	private final static int ROW_SETTING = 2;
	private final static int COL_SETTING = 6;
	
	public final static String START_STATE = "040404040404040404040404";
	
	public int age = 0;
	public double value = 0.0;
	
	public StateSimple(int startAge, double startValue) {
		age = startAge;
		value = startValue;
	}
	
	public static String codifyState(MancalaGameState state, int playerNumber) {
		StringBuilder builder = new StringBuilder();
		if (playerNumber == 0) {
			for (int i = 0; i < ROW_SETTING; i++) {
				for (int j = 0; j < COL_SETTING; j++) {
					if (state.grid[i][j] < 10) {
						builder.append(0);
					}
					builder.append(state.grid[i][j]);
				}
			}
		} else { //Reversed because 2nd player has a diff. perspective with regard to grid.
			for (int i = ROW_SETTING - 1; i >= 0; i--) {
				for (int j = COL_SETTING - 1; j >= 0; j--) {
					if (state.grid[i][j] < 10) {
						builder.append(0);
					}
					builder.append(state.grid[i][j]);
				}
			}
		}
		
		return builder.toString();
	}
	
	public static void printStateTable(HashMap<String, Double> map) {
		System.out.println(map.toString());
	}
	
	public static int sumOfBins(String stateCode) {
		int toReturn = 0;
		for (int i = 0; i < stateCode.length(); i++) {
			toReturn += Integer.valueOf("" +  stateCode.charAt(i));
		}
		return toReturn;
	}
	
	public static void main(String[] args) {
		
		try {
			BufferedReader reader = new BufferedReader(new FileReader("state_values.txt"));
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		
		
	}
}
